package xyz.jcat.biz.admin.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.jcat.biz.admin.service.IPermissionService;
import xyz.jcat.common.web.Resp;
import xyz.jcat.web.security.annotation.Menu;
import xyz.jcat.web.security.annotation.RequiresPermission;

@RestController
@RequestMapping("/permission")
@Menu(name = "权限管理", value = "permission_manage")
public class PermissionController {

    @Autowired
    private IPermissionService permissionService;

    @PatchMapping("/refresh")
    @RequiresPermission(name = "更新权限", value = "permission:refresh")
    public Resp refreshPermission() {
        permissionService.refresh();
        return Resp.ok();
    }

}
